package com.yang.SpringTest.annotation.conditionalLearn;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * <p>description</p>
 *
 * @author By: chengxuyuanshitang
 * Package com.yang.SpringTest.annotation.conditionalLearn
 * Ceate Time 2024-03-20 14:52
 */

public class ConditionalDemoCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String osName = context.getEnvironment().getProperty("sun.desktop");
        return osName.contains("windows") ? true : false;
    }
}
